<script>
import hljs from 'highlight.js'
import 'highlight.js/styles/a11y-dark.css'

/**
 * 高亮组件
 *    props: { language: string, code: string }
 */
export default {
  functional: true,
  render (h, context) {
    const { props } = context
    const hlStr = hljs.highlight(props.language, props.code).value
    return h('pre', {}, [h('code', {
      domProps: {
        innerHTML: hlStr
      }
    })])
  }
}
</script>

<style scoped>

</style>
